package com.test.mywebtest.Enum;

public enum GDDocumentEnum {

    FW(1,"发文"),
    SW(2,"收文"),
    WLTZ(3,"网络通知"),
    HYJY(4,"会议纪要");


    private int code;
    private String description;

    GDDocumentEnum(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    // 根据代码值获取对应的枚举实例
    public static GDDocumentEnum fromCode(int code) {
        for (GDDocumentEnum type : GDDocumentEnum.values()) {
            if (type.getCode() == code) {
                return type;
            }
        }
        throw new IllegalArgumentException("Invalid document type code: " + code);
    }
}
